import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GameGoodsInfoVO, GameGoodsInfoForm, GameGoodsInfoQuery } from '@/api/mushcoin/gameGoodsInfo/types';

/**
 * 查询TG游戏商品列表
 * @param query
 * @returns {*}
 */

export const listGameGoodsInfo = (query?: GameGoodsInfoQuery): AxiosPromise<GameGoodsInfoVO[]> => {
  return request({
    url: '/mushcoin/gameGoodsInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询TG游戏商品详细
 * @param id
 */
export const getGameGoodsInfo = (id: string | number): AxiosPromise<GameGoodsInfoVO> => {
  return request({
    url: '/mushcoin/gameGoodsInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增TG游戏商品
 * @param data
 */
export const addGameGoodsInfo = (data: GameGoodsInfoForm) => {
  return request({
    url: '/mushcoin/gameGoodsInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改TG游戏商品
 * @param data
 */
export const updateGameGoodsInfo = (data: GameGoodsInfoForm) => {
  return request({
    url: '/mushcoin/gameGoodsInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除TG游戏商品
 * @param id
 */
export const delGameGoodsInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/mushcoin/gameGoodsInfo/' + id,
    method: 'delete'
  });
};
